<?php
echo '<p><h3>Inventory Admin</h3>
<p><table><tr>
<td><a href="index.php?p=sinventory&f2=recycle">Recycle Pickup</a></td>
<td><a href="index.php?p=sinventory&f2=type">Inventory Type</a></td>
</tr></table>';

switch($_GET[f2])
{
case('type');
$result = mysql_query("SELECT * FROM tblinventorytype ");
echo '<table border=1>';
echo '<tr><td>key</td><td>Name</td><td>Delete</td></tr>';
while($row = mysql_fetch_array($result))
  {
echo '<form action="system/inventory/uinsert.php?f2='.$_GET[f2].'" method="POST"><tr><td><input type=text name="key" value="'.$row['key'].'"></td><td><input type=text name="Type" value="'.$row['Type'].'"></a></td><td><input type="checkbox" name="delete" value="checked"></td><td><input type=submit value=Update></td></form></tr>';
  }
echo '<tr><td><a href="index.php?p=shadd&f2='.$_GET[f2].'">Add</a>';
echo '</table>';
break;

case('recycle');
echo '<p><h3>Recycle items</h3>';
#echo "<br>Returned : <b>", mysql_affected_rows() ,"</b> Rows";
echo '<table><tr><td>ID</td><td>Branch</td><td>Department</td><td>Type of Equpment</td><td>Model</td><td>Serial Number</td><td>Checked by</td><td>Date Checked</td><td>Reason</td><td>Action</td><td>Faulty</td><td>Location</td></tr>';
$query=mysql_query("SELECT * FROM tblInventory WHERE Status Like '% scrap'");

$i=0;
while($row = mysql_fetch_array($query))
  {
echo '<form action="inventory/recycle1.php" Method="POST"><tr id="row'.$i.'" onMouseOver="row'.$i.'.style.backgroundColor=\'#F0F0F0\';" onmouseout="row'.$i.'.style.backgroundColor=\'#6495ED\';" onclick="location.href=\'index.php?m=i&p=iupdate&f2='.$row['ID'].' \'"><td><input size="3" type="hidden" name="key" Value="'.$row['ID'].'">'.$row['ID'].'</td><td>'.$row['Branch'].'</a></td><td>'.$row['Department'].'</td><td>'.$row['Type'].'</td><td>'.$row['Model'].'</td><td>'.$row['serial'].'</td><td>'.$row['CheckedBy'].'</td><td>'.$row['DateChecked'].'</td><td>'.$row['Reason'].'</td><td>'.$row['Action'].'</td><td>'.$row['Faulty'].'</td><td>'.$row['Status'].'</td><td><input type="submit" Value="Recycle"></tr></form>';
  $i=$i+1;

  }
  echo '</table>';
  break;
}
?>
